﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ENMAX_ArcGIS.Hardware_Controllers
{
    class MicrosoftSurfaceHardwareController
    {
    }
}


//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Windows;
//using System.Windows.Controls;
//using System.Windows.Input;
//using System.Windows.Interop;
//using System.Windows.Media;
//using Microsoft.Surface;
//using Microsoft.Surface.Presentation;

//namespace eHomeFloorPlan
//{
//    public class MicrosoftSurfaceHardwareController
//    {
//        private static MicrosoftSurfaceHardwareController microsoftSurfaceHardwareController = null;
//        private eHomeWindow eHomeWindow;
//        private MultiTouchLib multiTouchLib;

//        int firstTouchID = -1;
//        int secondTouchID = -1;

//        Point firstPosition = new Point();
//        Point secondPosition = new Point();

//        double prevDistance = 0.0;
//        double currentDistance = 0.0;

//        protected MicrosoftSurfaceHardwareController(eHomeMicrosoftSurfaceWindow mainWindow, eHomeWindow eHomeWindow)
//        {
//            this.eHomeWindow = eHomeWindow;

//            Microsoft.Surface.Core.ContactTarget contactTarget = new Microsoft.Surface.Core.ContactTarget(new WindowInteropHelper(Window.GetWindow(mainWindow)).Handle);
//            contactTarget.EnableInput();
//        }

//        #region Static Methods
//        public static void createInstance(eHomeMicrosoftSurfaceWindow eHomeMainWindow, eHomeWindow eHomeWindow)
//        {
//            if (microsoftSurfaceHardwareController == null)
//            {
//                microsoftSurfaceHardwareController = new MicrosoftSurfaceHardwareController(eHomeMainWindow, eHomeWindow);
//            }
//        }

//        public static MicrosoftSurfaceHardwareController getInstance()
//        {
//            return microsoftSurfaceHardwareController;
//        }
//        #endregion

//        #region Public Methods
//        public void handleContactDown(object sender, ContactEventArgs e)
//        {
//            if (firstTouchID == -1)
//            {
//                firstTouchID = e.Contact.Id;
//                firstPosition = e.Contact.GetPosition(null);
                
//                Core.InputDevices.Mouse.Instance.Location = new System.Drawing.Point((int)firstPosition.X, (int)firstPosition.Y/* - 15*/);
//                Core.InputDevices.Mouse.LeftDown();
//            }

//            if (firstTouchID != -1 && secondTouchID == -1)
//            {
//                secondTouchID = e.Contact.Id;
//            }
//        }

//        public void handleContactChanged(object sender, ContactEventArgs e)
//        {
//            if (e.Contact.Id == firstTouchID)
//            {
//                firstPosition = e.Contact.GetPosition(null);
//                Core.InputDevices.Mouse.Instance.Location = new System.Drawing.Point((int)firstPosition.X, (int)firstPosition.Y/* + 15*/);
//            }

//            else
//            {
//                Core.InputDevices.Mouse.LeftUp();
//                secondPosition = e.Contact.GetPosition(null);

//                prevDistance = currentDistance;
//                currentDistance = MathLib.getInstance().calcDistanceBetweenPoints(firstPosition, secondPosition);

//                if (MathLib.getInstance().calcDifferenceBetweenValues(currentDistance, prevDistance) > 5)
//                {
//                    multiTouchLib.handleImageResize(currentDistance, prevDistance);
//                }
//            }
//        }

//        public void handleContactUp(object sender, ContactEventArgs e)
//        {
//            if (e.Contact.Id == firstTouchID)
//            {
//                Core.InputDevices.Mouse.LeftUp();
//                firstTouchID = -1;
//            }

//            if (e.Contact.Id == secondTouchID)
//            {
//                secondTouchID = -1;
//            }
//        }

//        public void handleContactHoldGesture(object sender, ContactEventArgs e)
//        {
//            Core.InputDevices.Mouse.Instance.RightClick();
//        }

//        public void setUpMultiTouchLib()
//        {
//            multiTouchLib = new MultiTouchLib(eHomeWindow.FloorPlanImage, eHomeWindow.FloorPlan, eHomeWindow.DeviceList, eHomeWindow.ContainerList, eHomeWindow.SensorList, eHomeWindow.FloorPlanStagingArea);
//        }
//        #endregion
//    }
//}
